//
//  YZMSpreadUserCell.m
//  YZMicroStock
//
//  Created by apple on 17/1/5.
//  Copyright © 2017年 cqjr. All rights reserved.
//

#import "YZMSpreadUserCell.h"
#import "NSNumber+Utils.h"
#import <DateTools/DateTools.h>


@interface YZMSpreadUserCell ()
@property(nonatomic, strong) UILabel *titleLabel;
@property(nonatomic, strong) UILabel *numberLabel;
@property(nonatomic, strong) UILabel *timeLabel;

@end

@implementation YZMSpreadUserCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createObject];
    }
    return self;
}

-(void)createObject{
    
    self.titleLabel=[YZMAppStyle labelWithSmallWhite];
    _titleLabel.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(16);
        make.width.mas_offset(ScreenWidth*0.3);
    }];
    
    self.numberLabel=[YZMAppStyle labelWithSmallWhite];
    _numberLabel.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_numberLabel];
    [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.top.equalTo(_titleLabel);
        make.width.mas_offset(ScreenWidth*0.3);
        make.left.equalTo(_titleLabel.mas_right);
    }];
    
    self.timeLabel=[YZMAppStyle labelWithSmallWhite];
    _timeLabel.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLabel);
        make.width.mas_offset(ScreenWidth*0.4);
        make.right.equalTo(self);
    }];
}


-(void)setModel:(YZMUserSpreadModel *)model{
    
    _titleLabel.text=model.username;
    _numberLabel.text=@(model.money).p0fString;
    _timeLabel.text=[model.registerTime formattedDateWithFormat:@"YYYY-MM-dd HH:mm:ss"];
}

@end
